home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr22 / mcalc199.zip / MCALC.DOC < prev    next >
Text File  |  1995-01-22  |  66KB  |  1,955 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                          Mcalc : The Master Calculator.
  10.  
  11.  
  12.     Registering Mcalc.
  13.     ------------------
  14.  
  15.     Mcalc is not "free", neither it is "public domain". It is a copyrighted
  16.     and commercial program distributed  through the shareware channel. This
  17.     allows you to try the program  first to see if it suits your needs.  If
  18.     you decide to continue using it after 3 weeks, then you are expected to
  19.     pay the author a registration fee, which costs only 2000 Bef or $49 for
  20.     individual  use, or less  per machine if  you get a  site license. Some
  21.     users may even qualify for a free registration.
  22.  
  23.     All the features present in  the registered version are also present in
  24.     the  evaluation copy. Only the extra add-in utilities have been removed
  25.     from this copy as they could need  too much disk spaces to be distribu-
  26.     ted in a convenient way via the most used shareware  channels:  BBS and
  27.     phone links. I think that by  letting you try all of the features,  you
  28.     will decide  to register  if you want  to continue using  this program.
  29.     Please, help prove me right be sending your registration.
  30.     Your  registration will  motivate me  to spend  the time  and resources
  31.     necessary  to add  some of  the features  that you  ask for.  The delay
  32.     screen at  the  end of  this  evaluation copy  is  not present  in  the
  33.     registered version. 
  34.  
  35.     Please,  refer  to the  ORDER.DOC  for instruction  on how  to register
  36.     Mcalc, and prices.
  37.  
  38.     I  will try  to extend  my support  to unregistered users  during their
  39.     evaluation period, however, I reserve the right to limit my support for
  40.     unregistered  users if  their requests  become taxing  for me.  You may
  41.     correspond  by postal  mail:  please,  send  a  self  adressed  stamped
  42.     enveloped in order for me to reply. If your adress  is outside Belgium,
  43.     add a $1 money for the answer costs.
  44.  
  45.     Free registration for qualified students: if your school lab has a site
  46.     license for the Master Calculator for use on 10 or more computers, then
  47.     up to five students from your school can receive a free registered copy
  48.     of  the program. All you have to do is send me your request, along with
  49.     thename of your  school. Please, check  first to make sure  you qualify
  50.     for this offer.
  51.  
  52.     A site  is considered  to be  any corporation,  institution, government
  53.     agency, computer lab, or non-personal organization,  with more than one
  54.     computer  capable  of  running  Mcalc  software,  and  with  a  locally
  55.     accessible  tech support person or team.  A site may use the evaluation
  56.     version  for evaluation  only. If  the site  decides to  continue using
  57.     Mcalc  after  21  days,  a site  license  must  be  purchased.  See the
  58.     ORDER.DOC for low  rates that are available. A site  license is for use
  59.     within the site and is not transferable. 
  60.  
  61.  
  62.                                        1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                          Mcalc : The Master Calculator.
  71.  
  72.  
  73.     This  license allows the internal use and  copying of the sofware by as
  74.     many  computers as  contracted  for. The  unregistered  version may  be
  75.     freely distributed.
  76.  
  77.     The  Master  Calculator software  is  distributed on  an "as  is" basis
  78.     without any warranty of any kind, expressed or implied. The author will
  79.     not  be liable  for any special,  incidental, consequential,  direct or
  80.     indirect damages due to any malfunctions.
  81.  
  82.     My adress:          Didier Gosseau.
  83.                         Rue Georges Lorand nΦ 19.
  84.                         B 1050    Brussels.
  85.                                   Belgium.
  86.  
  87.     Distribution:  You are  encouraged to distribute the  shareware version
  88.     of Mcalc. The following files must be present and unmodified:
  89.  
  90.     Mcalc.exe                Master calculator task.
  91.     Mcalc.hlp & Mcalc.hl2    On-line text and index files.
  92.     mc_unit.dat              Physical units database.
  93.     Mcalc.key                User key definition file.
  94.     Helvb.fon                Helveticca characters fonts.
  95.     demo.bat demo.mac        Demonstration macro and auxillary files.
  96.     demo03a.mcp demo04.mcp
  97.     demo05.txt
  98.     mcalc.doc                This file.
  99.     order.doc                The ordering form.
  100.  
  101.     The compressed file name must be MCALC19.??? with ??? being ARJ, ZIP or
  102.     whatever compression suffix being used.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.                                        2
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                          Mcalc : The Master Calculator.
  132.  
  133.  
  134.     Contents.
  135.     ---------
  136.  
  137.     1.  Introduction.
  138.     2.  Mcalc features.
  139.     3.  Installation.
  140.     4.  Getting started.
  141.     5.  Getting help with Mcalc.
  142.     6.  A few first steps using Mcalc.
  143.     7.  The Mcalc user interface in brief.
  144.     8.  Functions and commands.
  145.     9.  Procedures.
  146.     10. Using the plotter and the solver.
  147.     11. Using the statistical functions and commands.
  148.     12. Numerical analysis.
  149.     13. Physical units conversion.
  150.     14. Using the keyboard macros.
  151.     15. Advanced and particular topics.
  152.     16. The Mcalc files.
  153.  
  154.     1. Introduction.
  155.     ----------------
  156.  
  157.     Mcalc  is a scientific calculator for MSDOS based computers that offers
  158.     a  lot  of features  most  of the  time  only available  in  high class
  159.     scientific  packages.  Mcalc  offers  a  lot  of  build  in  functions,
  160.     operators, numerical  notations and modes.  Graphics, keyboard  macros,
  161.     user task extensions and  many more are available. Expressions  such as
  162.     the following can be computed:
  163.  
  164.          63 - 5 + 4.821
  165.  
  166.          (5.9-abs(2.8/5-3))^2+sin(3-(pi+3/4)
  167.  
  168.          15 * sin(pi/4)+abs(10-5+log(20)^2+9) - #b101110111
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.                                        3
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.                          Mcalc : The Master Calculator.
  193.  
  194.  
  195.     2. Mcalc features.
  196.     ------------------
  197.  
  198.     -    double precision 64 bits floating number calculation.
  199.     -    logical  arithmetic syntax  using a  BASIC like  recursive descent
  200.          expression parser.
  201.     -    rich set of scientific  functions including gaussian curve, bessel
  202.          functions, statistical functions...
  203.     -    interactive  functions,  procedures  and  experimental  data  sets
  204.          plotter.
  205.     -    rich   set  of  commands   including  plotter,   equation  solver,
  206.          integration,      interpolation,     multi-model      regressions,
  207.          correlation...
  208.     -    multiple  programmer radix  notation: decimal,  hexadecimal, octal
  209.          and binary.
  210.     -    programming possibilities via Procedure-Basic.
  211.     -    on-line hypertext help system.
  212.     -    physical units converter and intelligent units database.
  213.     -    customizable user keys.
  214.     -    keyboard macros.
  215.     -    extension possibilities via user "tasks".
  216.     -    session login file support
  217.     -    support CGA, EGA, VGA and coprocessor hardware on any AT, 386, 486
  218.          and PENTIUM platform.
  219.     -    needs MSDOS 3.3 or later.
  220.  
  221.  
  222.  
  223.     3. Installation.
  224.     ----------------
  225.  
  226.     Make a \mcalc subdirectory into your harddisk and copy all the files to
  227.     it. All  files beginning with "demo**.***"  constitutes a demonstration
  228.     tutorial  of Mcalc possibilities. They are not necessary for commun use
  229.     and can be deleted if you don't plan to run the demonstration.
  230.     Mcalc must be run from its current directory. 
  231.  
  232.  
  233.     4. Getting started.
  234.     -------------------
  235.  
  236.     There are three ways to run Mcalc:
  237.  
  238.     -    from the command line:  mcalc 5+4*8/2
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.                                        4
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.                          Mcalc : The Master Calculator.
  254.  
  255.  
  256.     -    in evaluation mode:     mcalc [enter]
  257.          when you are in this mode,  you get the mcalc> prompt that invites
  258.          you to  enter a mcalc command or an expression to be evaluated. In
  259.          this mode, strike [F1] at any time for help, or  [Alt-F10] to quit
  260.          the program. See the  examples later in this documentation  to get
  261.          more ideas about using Mcalc.
  262.  
  263.     -    in procedure mode. You can evaluate a procedure from within Mcalc.
  264.  
  265.  
  266.     The  best  way to  evaluate  Mcalc is  first to  run  the demonstration
  267.     tutorial. To  do that, make sure that you are in the Mcalc subdirectory
  268.     and that the following files are available:
  269.  
  270.          - mcalc.exe, mcalc.hlp and mcalc.hl2
  271.          - helvb.fon, mcalc.key and mc_unit.dat
  272.          - demo.bat, demo03a.mcp, demo04.mcp and demo05.txt
  273.  
  274.     From the DOS, give the following command:
  275.  
  276.          DEMO.BAT
  277.  
  278.     The  demonstration tutorial is started. Don't strike any key during the
  279.     demonstration,  excepted  when  the  <<<Demo  is  pausing>>>  label  is
  280.     displayed. The compleet demonstration takes approximately 20 minutes.
  281.     After the demo, you will have a good idea about Mcalc possibilities.
  282.     If something goes  wrong or you want  to abort the demo,  strike one or
  283.     more  time the  [Ctrl End] key.  Then, at  the mcalc>  prompt, type the
  284.     'quit' command, followed by [Enter].
  285.  
  286.     After  the demo, continue the evaluation Mcalc by  yourself. You should
  287.     look at the on-line help system if you need detailled information about
  288.     a  particular topics. This  documentation is just intended  to help you
  289.     starting with Mcalc. Each time you should learn more detailled info, we
  290.     will direct you to a particular help topic.
  291.  
  292.  
  293.     5. Getting help with Mcalc.
  294.     ---------------------------
  295.  
  296.     Inside Mcalc,  you can  obtain help  at any time,  by striking  [F1] in
  297.     response to the Mcalc> prompt.  You can also get help, by  entering the
  298.     'help'  command followed by return. You can finally obtain help about a
  299.     particular subject  by entering  the  'help' command,  followed by  the
  300.     subject between double quotes.
  301.  
  302.     For example, to obtain help about the on-line help system, strike:
  303.  
  304.          help "???"
  305.  
  306.                                        5
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.                          Mcalc : The Master Calculator.
  315.  
  316.  
  317.     6. A few first steps using Mcalc.
  318.     ---------------------------------
  319.  
  320.     The first time you use Mcalc, you will get the following screen:
  321.  
  322.     Mcalc, the Master Calculator.                 Version : 1.99
  323.     Copyright (C) 1994 by Didier Gosseau.
  324.  
  325.     Give 'help'  or strike F1  for help,  'listk' or Ctrl  F1 for  function
  326.     keys.
  327.  
  328.     'mcalc.ini' not found! Default values will be used...
  329.     Use the 'setup' command to customize them.
  330.  
  331.  
  332.  
  333.  
  334.  
  335.     Mcalc >
  336.  
  337.     This is normal. Mcalc uses default values that are customized. It store
  338.     them into the 'mcalc.ini' file. At the first usage, that  file does not
  339.     already exists. Mcalc created it and give you a warning. We will ignore
  340.     that   message  for  now,   and  performs  a  few   using  the  default
  341.     parameters.When you get the "mcalc >" prompt, this means  that Mcalc is
  342.     ready and wait for a command or an expression to compute.
  343.  
  344.  
  345.     6.1.Evaluating a simple expression.
  346.     -----------------------------------
  347.  
  348.     Mcalc is now  ready to evaluate  a simple expression.  Let suppose  you
  349.     want to compute the following:
  350.  
  351.                                   12.4 * 5 / 4
  352.  
  353.     You just  strike this expression, as  you would normally write  it on a
  354.     paper, and Mcalc supplied immediately the answer:
  355.  
  356.     mcalc > 12.4*5/4               
  357.     Answer =              15.5
  358.  
  359.     mcalc >                        
  360.  
  361.     As  you  see, each  time  you  strike  an  expression, it  is  directly
  362.     evaluated using the standard arithmetic notation. Later in this manual,
  363.     we  will  explain in  details  the rules  used  to  write correctly  an
  364.     expression.
  365.  
  366.  
  367.                                        6
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.                          Mcalc : The Master Calculator.
  376.  
  377.  
  378.     6.2. Evaluating a complex expression.
  379.     -------------------------------------
  380.  
  381.     Mcalc  is  also  directly  suitable  to  evaluate  a  more  complicated
  382.     expression, involving number and constants.
  383.     For example, let us try to find the value of a second order polynomial:
  384.  
  385.                                  ax^2 + bx + c
  386.  
  387.     where  a=1, b=-2  and c=-3.  Let  suppose x=-5.  You could  for example
  388.     directly strike:
  389.  
  390.     mcalc > 1*(-5)^2-2*(-5)-3    
  391.     Answer =                32
  392.  
  393.  
  394.     but it is also possible to use variables to store constant values....
  395.  
  396.     mcalc > a=1               
  397.                                 
  398.     mcalc > b=-2                
  399.                                 
  400.     mcalc > c=-3                 
  401.                                 
  402.     mcalc > x=-5                
  403.                                 
  404.     mcalc > +a*x^2+b*x+c        
  405.     Answer =                32
  406.  
  407.     6.3. Writing a simple procedure to plot this polynomial.
  408.     --------------------------------------------------------
  409.  
  410.     If you have to evaluate this polynomial for multiple values of x, it is
  411.     preferable to write this  equation as a simple procedure.  For example,
  412.     you can write directly the equation:
  413.  
  414.                                y = ax^2 + bx + c
  415.  
  416.     as a procedure that can be evaluated or plotted later. To do that,  you
  417.     give the edit command, that enter  the edit mode. Then, you strike e to
  418.     select the  (E)dit option  of the  displayed menu. You  are now  in the
  419.     Internal  editor. Despite its  very limited features, it  is enough for
  420.     today to  enter this  one line  equation. You strike  now directly  the
  421.     equation,  just like  you would  have written  it  on a  paper! Strike:
  422.     y=a*x^2+b*x+c followed by  a Return. The first and  unique line of this
  423.     small procedure is written. You strike now  ESCape to quit the internal
  424.     editor. If you  want, you can save  the procedure as  a file for  later
  425.     usage. To do that, strike s to select the (S)ave function. Mcalc prompt
  426.  
  427.  
  428.                                        7
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.                          Mcalc : The Master Calculator.
  437.  
  438.  
  439.     you for  a file name. Enter  for example: ex1 followed  by Return. Your
  440.     screen looks now like the following:
  441.  
  442.     y=a*x^2+b*x+c                                                        
  443.                                                                          
  444.                                                                          
  445.                                                                          
  446.     Command mode : (L)oad, (S)ave, (E)dit, (R)un, (N)ew, (D)ir ,(Q)uit   
  447.  
  448.     You have now  written a procedure  that compute an  expression that  is
  449.     function of the variables a,b,c and x and that returns a value into the
  450.     variable y. In our case, a,b  and c are constants and their  values are
  451.     already stored. We don't need to enter them again. As long as you  stay
  452.     within Mcalc,  the values assigned to  variables are not lost.  We have
  453.     thus a procedure that is a function of variable x and that send back an
  454.     answer in variable y.
  455.  
  456.     Strike now q to (Q)uit the editor mode. You get back the mcalc> prompt.
  457.     You  can  now plot  the  function using  the  plot command.  To  plot a
  458.     procedure, you just need  to specify the independent or  input variable
  459.     name (in  our case 'x'),  the dependant or output  variable (here 'y'),
  460.     the  first and  last values of  the input  variable, and  the number of
  461.     points  to plot. In this example, we plot 100 points for x in the range
  462.     [-5,10].
  463.                                  
  464.     mcalc > plot x,y,-5,10,100   
  465.  
  466.     You are now in interactive  mode. This mode give you some possibilities
  467.     that will  be explained in  great details in  chapter 5. For  now, just
  468.     look at  the  graphic and  note  that the  function  has two  roots  at
  469.     approximately -1.5 and +3.5. It is now interesting to use the solver to
  470.     find the exact values of these roots.
  471.  
  472.  
  473.     6.4. Using the solver.
  474.     ----------------------
  475.  
  476.     To use the solver, you write a procedure  exactly on the same manner as
  477.     you  do  to plot  a function.  In  this example,  the procedure  EX1 is
  478.     already  loaded and  ready for  use. You  find a  root using  the solve
  479.     command.  You must also specify the independent or input variable name,
  480.     the output variable and an  initial root value to start the  solver. In
  481.     this example, we start searching a root from -1.5.
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.                                        8
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.                          Mcalc : The Master Calculator.
  498.  
  499.  
  500.     mcalc > solve x,y,-1.5                                                 
  501.  
  502.     Solving the procedure .....
  503.     Solver root/extremum found:
  504.     Root     = -1.00000009449577 [              -1.5 ]
  505.     Eval     = 3.7798309193704e-007
  506.     Another case ? =                                <Y>
  507.     Initial approximation [ -1e+050,1e+050 ] =       3.5
  508.  
  509.     Solving the procedure .....
  510.     Solver root/extremum found:
  511.     Root     =  3.00000009763274 [               3.5 ]
  512.     Eval     = 3.90530948024548e-007
  513.     Another case ? =                                <N>
  514.                                           
  515.     mcalc >                                                
  516.  
  517.     As you can see, Mcalc has found a first root at -1 and a second one  at
  518.     +3.  This was  of  course  the  expected  results  for  such  quadratic
  519.     polynomial....
  520.  
  521.  
  522.     7. The Mcalc user interface in brief.
  523.     -------------------------------------
  524.  
  525.     7.1. Evaluation and procedure modes.
  526.     ------------------------------------
  527.  
  528.     Mcalc uses two working modes: evaluation and procedure.
  529.  
  530.     When you start Mcalc, you get the 'mcalc >' prompt. This means that you
  531.     are in evaluation mode. Each time  you enter one line and press Return,
  532.     Mcalc  evaluate the line you typed  and look to compute the expression,
  533.     or  to recognize a command and execute it. In this mode, Mcalc can only
  534.     recognize three basic situations:
  535.  
  536.     An expression is available. In this case, Mcalc evaluate it and returns
  537.     the value with the 'answer' prompt.
  538.  
  539.     mcalc > *12*sin(45)+exp(-1)*fact(5)
  540.     Answer = 52.630814314811640       
  541.  
  542.     Mcalc can  evaluate many expressions in one  step. Multiple expressions
  543.     must be separated by "space" characters.
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.                                        9
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.                          Mcalc : The Master Calculator.
  559.  
  560.  
  561.  
  562.  
  563.     mcalc > 12/3 4*5 (4+2)/0.1  
  564.     Answer =                 4
  565.     Answer =                20
  566.     Answer =                60
  567.  
  568.     The second case is a variable  assignment. In this case, you assign the
  569.     value of an expression to a variable, like in the following example:
  570.  
  571.     mcalc > a=sin(45)/3 
  572.  
  573.     The  expression  (in this  example:  sin(45)/3 )  is evaluated  and the
  574.     resulting  value is  stored into  the specified  variable ('a'  in this
  575.     case!).
  576.  
  577.     The last case, a command is given and will be processed....
  578.  
  579.     mcalc > cls
  580.  
  581.     In  this example, the 'cls' keyword is recognized and will be executed.
  582.     It clears the screen's contents.
  583.  
  584.  
  585.     7.2. The notation used.
  586.     -----------------------
  587.  
  588.     Mcalc use a notation  for the functions, commands and  expressions that
  589.     is very similar  to BASIC. This is  the reason that we have  called the
  590.     procedure  language the Procedure  Basic. You should only  keep in mind
  591.     that normally any expression is supposed to be in decimal.  Other radix
  592.     numbers  can be  entered  using  a  particular  prefix.  The  '#'  sign
  593.     introduces another  radix than decimal. Mcalc  recognizes the following
  594.     prefix:
  595.  
  596.     #x   #h   #o   #b   #a   and  #v.
  597.  
  598.     For more info:      help "notation"
  599.  
  600.  
  601.     7.3. Specifying default parameters with 'setup'.
  602.     ------------------------------------------------
  603.  
  604.     In practice, Mcalc  does not ask you every time  if arc expressions are
  605.     entered in degree or  radian, if a mouse must be used in graphical mode
  606.     ,  and so on. Mcalc based its  behaviour on default parameters that you
  607.     can modify using the 'setup' command. When the command  is given, Mcalc
  608.     starts  a dialogue  where is  displays each  current settings.  You can
  609.     modify a setting by entering another value.
  610.  
  611.                                        10
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.                          Mcalc : The Master Calculator.
  620.  
  621.  
  622.     If you strike just a Return, you means that you agree with the proposed
  623.     value and don't want to modify it.
  624.     If you strike  just a  /, you means  that you agree  with the  proposed
  625.     value,  don't want  to modify  it, nor any  further question.  Giving a
  626.     slash  ('/') in  a Mcalc  dialogue  means that  you want  to  stop that
  627.     dialogue!
  628.  
  629.     When  you quit  Mcalc,  your current  settings  are saved  into  a file
  630.     'mcalc.ini'. The next time  you start Mcalc, the settings  are directly
  631.     loaded from  that file  and available.  The first time  you use  Mcalc,
  632.     default  settings values are used because the 'mcalc.ini' file does not
  633.     exist!
  634.  
  635.     For more info:      help "setup"
  636.  
  637.  
  638.     7.4. User defined keys.
  639.     -----------------------
  640.  
  641.     The functions keys F1 to F10 and their associated keys,  Shift, Control
  642.     and Alternate are called user defined keys.
  643.     When you install Mcalc,  some strings are  associated to some of  these
  644.     keys. If you give the liskk command, Mcalc replies with the list of all
  645.     user defined keys that have some string attached to them.
  646.  
  647.     For more info:      help "listk"
  648.  
  649.  
  650.     7.5. Last result and last commands.
  651.     -----------------------------------
  652.  
  653.     When  in evaluation  mode, Mcalc  always remember  the last  answer and
  654.     store  it internally.  The  'last' keyword  is  used as  an  expression
  655.     returning the last calculation answer. By that way, it is  very easy to
  656.     split a long calculus  into smaller one, without  having to retype  the
  657.     answer.  For  example,  suppose  you  have  to  compute  the  following
  658.     expressions:
  659.  
  660.                                    12/(45-32)
  661.                                 12/(45-32) + 1/8
  662.  
  663.     As  you can see,  the second expression will  be the same  as the first
  664.     one,  but having  1/8 added. You  do this  easily with  Mcalc using the
  665.     following sequence:
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.                                        11
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.                          Mcalc : The Master Calculator.
  681.  
  682.  
  683.     mcalc > 12/(45-32)         
  684.     Answer = 0.923076923076923 
  685.                                
  686.     mcalc > last+1/8             
  687.     Answer = 1.048076923076923 
  688.                                
  689.     mcalc >                    
  690.  
  691.  
  692.     For more info:      help "last"
  693.  
  694.     Another  useful features  of Mcalc  evaluation mode  is the  ability to
  695.     retrieve previous  expression to  modify them.  Mcalc remembers the  20
  696.     last  expressions  or commands  you  have used  in evaluation  mode. By
  697.     striking the Up  arrow, you  display the previous  expression from  the
  698.     buffer. By striking the Down arrow, you retrieve the next expression.
  699.  
  700.     If  you  have  executed  correctly  this tutorial  worked  example,  by
  701.     following carefully the steps  described in this documentation,  if now
  702.     you strike once the Up key, you get the following:
  703.  
  704.     mcalc > last+1/8             
  705.  
  706.     If you  strike  immediately return,  the  same expression  is  evaluate
  707.     again. Do it now.
  708.  
  709.     mcalc > last+1/8            
  710.     Answer = 1.173076923076923
  711.                               
  712.     mcalc >                   
  713.  
  714.     As you  can see, you  don't obtain the  same result, because  with such
  715.     kind of  expression, each type you evaluate it, the next last result is
  716.     stored into the 'last' variable! 
  717.     Suppose now that you have to evaluate the following expression:
  718.  
  719.                                 12/(45-32) + 1/6
  720.  
  721.     The quickest way to do  it is to retrieve the previous  expression that
  722.     look  the most  like this  one. Strike  the Up  key until  you  see the
  723.     following on your screen:
  724.  
  725.     mcalc > 12/(45-32)
  726.  
  727.     Now, strike  10 times the Right key until  the cursor is just after the
  728.     closing ).  An other manner  is to strike  the End key,  that moves the
  729.     cursor at the end of the line.
  730.     Now,  fill the remainder  of the expression: +1/6  and strike a return.
  731.     You obtain:
  732.  
  733.                                        12
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.                          Mcalc : The Master Calculator.
  742.  
  743.  
  744.     mcalc > 12/(45-32)+1/6    
  745.     Answer = 1.089743589743590
  746.  
  747.     Please, remember that in evaluation mode, the Up and Down keys  display
  748.     the  previous  or  next expressions  from  the  list  of  the  last  20
  749.     previously  evaluated expressions or  commands. The  End and  Home keys
  750.     move  the cursor at the end  or the beginning of  the current line. The
  751.     Enter  or  Return  keys  start the  evaluation  of  the expression,  or
  752.     command. If the  key is not  at the beginning or  the end of the  line,
  753.     everything at the right of the cursor is ignored.
  754.  
  755.  
  756.     7.6. Changing the output format.
  757.     --------------------------------
  758.  
  759.     Mcalc  offers  you  the  possibilities  to  modify  the  output  number
  760.     presentation. To do that, you use the format command. By default, Mcalc
  761.     displays  numbers in floating  notation using 15 digits  after the dot.
  762.     You  may modify  this  in accordance  with  your  own needs  using  the
  763.     following syntax:
  764.  
  765.                              format "format string"
  766.  
  767.     The format is defined using the language C ANSI format specifiers.
  768.  
  769.     For more info:      help "format"
  770.  
  771.  
  772.     7.7. Evaluating an expression and respecting priorities.
  773.     --------------------------------------------------------
  774.  
  775.     The  kernel of  Mcalc is  a piece  of software  called the  parser. The
  776.     parser,  or expression  parser, transforms  numeric expressions  into a
  777.     form that the computer can understand and evaluate. In Mcalc,  we use a
  778.     recursive  descent   parser.  This  complicate  name   means  that  any
  779.     expression is  decomposed into simplest  one, that are  also decomposed
  780.     and this  process occurs until  the expression is  reduced to  a single
  781.     value. Despite  the fact that this looks very complicated to explain in
  782.     details, it is exactly the same as what you do implicitly when you  try
  783.     to solve an expression like:
  784.  
  785.                                 9/3 - (100 + 56)
  786.  
  787.     When  you  compute such  expression,  first  you  recognize  that  this
  788.     expression is composed  of two  terms: 9/3 and  (100+56).You break  the
  789.     expression into a sum (or difference) of terms.
  790.  
  791.  
  792.  
  793.  
  794.                                        13
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.                          Mcalc : The Master Calculator.
  803.  
  804.  
  805.     Next, for  each  term, you  break it  into a  product  of factor.  (The
  806.     product can be a multiplication of a division.)
  807.     In this  case, the first term 9/3 is  composed of the two factors 9 and
  808.     3. 
  809.  
  810.     Next, each  factor can be a variable, a  number or an expression. If it
  811.     is  an  expression, the  same  process must  be  repeated reccursively:
  812.     breaking into terms and factors and subexpression. In this example, the
  813.     factors 9 and  3 being the  simplest numbers, the term  9/3 = 3 can  be
  814.     evaluate.
  815.  
  816.     The second term (100 + 56) must now be evaluate. We break it into terms
  817.     100 and 56. Each  term is broken into factors: here very  obvious : 100
  818.     and 56. The second term is evaluate and is 156.
  819.  
  820.     Now the expression is  reduced to two terms : 3 - 156.  They are broken
  821.     into terms: 3 and 156. These terms are obvious and cannot be split into
  822.     factor. They are thus directly evaluated and we obtain finally : -153.
  823.  
  824.  
  825.     As you can  see from this  process, Mcalc will  naturally follows  some
  826.     precedence of operators when parsing an expression. From the highest to
  827.     the lowest priorities, it recognizes:
  828.  
  829.          functions
  830.          ( )
  831.          ^              means 'power of'                   2^3 = 2 * 2 * 2
  832.          * /            multiplication & division
  833.          + -            sum and difference
  834.  
  835.     This means that the following expressions are equivalent:
  836.  
  837.                                  9/3 + 100 + 56
  838.                                 (9/3) + (100+56)
  839.  
  840.     Because / is executed before  +, an expression like (9/3)+ is  the same
  841.     as 9/3+ .
  842.     Also, (100  + 56) will be computed before  +100 + 56, but the result is
  843.     the same!
  844.  
  845.     But, you must use parenthesis if  you assign more priorities to the sum
  846.     than for  the product,  because in such  case you  don't respect  Mcalc
  847.     parser rules. For example:
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                        14
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.                          Mcalc : The Master Calculator.
  864.  
  865.  
  866.                                  (9+3) / (4+5)
  867.  
  868.     is not the same as:            9+3 / 4+5
  869.  
  870.     Don't  forget that  Mcalc  ignores the  tabulations  and spaces  in  an
  871.     expression.
  872.  
  873.  
  874.     7.8. Using variables.
  875.     ---------------------
  876.  
  877.     Mcalc provides 26 direct access variables named 'a' to 'z'. You can use
  878.     them to store temporary values or constants  very often used, or during
  879.     a  procedure. Mcalc also supplies up to 8000 indirect access variables.
  880.     The number of available variables depends of your memory and the setup.
  881.  
  882.     For more info:      help "variables"
  883.     For more info:      help "setup"
  884.     For more info:      help "list"
  885.  
  886.     8. Functions and commands.
  887.     --------------------------
  888.  
  889.     The Mcalc's parser recognizes some keywords.  These keywords are linked
  890.     to a particular meaning. Each keyword can be a function, a command or a
  891.     separator.
  892.  
  893.     A function evaluate  an expression  and returns an  unique value.  That
  894.     value can be  displayed or used inside  a more complex  expression. The
  895.     function takes expects  eventually a list of other  expression enclosed
  896.     into ().  Some expression expects no argument and  return a value, like
  897.     'pi'. Other expects one or more arguments as 'sin(arc)'.
  898.  
  899.     A  command  is a  special  keyword that  expects eventually  some extra
  900.     arguments using a particular syntax. It initiates an action. The action
  901.     can display a result, but does not returns a value.
  902.  
  903.     In other words, a function can  be enclosed into an expression, while a
  904.     command may expect one or  more expressions as arguments, but cannot be
  905.     enclosed itself into another expression.
  906.  
  907.     For more info:      help "keywords"
  908.     For more info:      help "functions"
  909.     For more info:      help "commands"
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.                                        15
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.                          Mcalc : The Master Calculator.
  925.  
  926.  
  927.     9. Procedures.
  928.     --------------
  929.  
  930.     9.1. Purpose and limitations of "Procedure-Basic".
  931.     --------------------------------------------------
  932.  
  933.     The Procedure-Basic language is the programming language used by Mcalc.
  934.     Some commands are  used in  evaluation mode, like  for example  format,
  935.     edit, list ... but most  of the commands are used in  procedure running
  936.     mode. Up to now, we have always used Mcalc as a simple calculator. This
  937.     means that  expressions and commands  were directly processed  from the
  938.     command line. This is the evaluation mode.
  939.     It  is also  possible to  write a  series of  instructions into  a file
  940.     called a  program or a procedure.  Then you run the  compleat procedure
  941.     after. This delayed  mode is  called the procedure  mode. The  language
  942.     used to write such procedures is called Procedure-Basic because it is a
  943.     BASIC like language.
  944.  
  945.     Procedure-Basic is  intended to  write procedures, not  programs. Mcalc
  946.     being a calculator and not a BASIC interpreter, we consider a procedure
  947.     as a small program  only intended to describe easily some  equations or
  948.     to  perform simple  tasks. Due  to this  specific and  limited purpose,
  949.     Procedure-Basic  is a  small  subset of  BASIC,  but includes  powerful
  950.     commands like  solve,  plot ...  Also  a procedure  is  subject to  the
  951.     following limitations:
  952.  
  953.     -    no string character variables and operators.
  954.     -    only one instruction or expression by line.
  955.     -    maximum 50 lines / procedure.
  956.     -    incorporated  editor works  only  with the  20  first lines  of  a
  957.          procedure.
  958.  
  959.     You should  not consider  Procedure-Basic as a  traditional programming
  960.     language  to write sophisticated programs. It is only intended to write
  961.     single tasks or medium complexity expressions.
  962.  
  963.     9.2. The Procedure-Basic instructions set.
  964.     ------------------------------------------
  965.  
  966.     We only introduce here the various keywords of Procedure-Basic. Please,
  967.     refer to the on-line help for detailed explanations about each keyword.
  968.     The language recognizes the following:
  969.  
  970.     The input and  print commands are used to perform input/output with the
  971.     user. 'input' is used to temporary stop the program, let the user enter
  972.     a value which is assigned to a variable. The 'print' command is used to
  973.     display string message and expression's values.
  974.  
  975.  
  976.  
  977.                                        16
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.                          Mcalc : The Master Calculator.
  986.  
  987.  
  988.     Specific input/output operations from/to  text files are possible using
  989.     read, read_,  write, close, finput,  finput_ and  print. These  permits
  990.     reading  values from  a file,  processing them  with Mcalc  and writing
  991.     results back to another file.
  992.  
  993.     The if...then and goto commands  are used to control the execution flow
  994.     conditionally and unconditionally.
  995.  
  996.     The gosub  and return keywords are used to  redirect the execution flow
  997.     to/from subroutine. Up to  20 levels of subroutines may be  cascaded. A
  998.     subroutine is  useful to perform  continuously the  same task,  without
  999.     having to rewrite it at many  place in the procedure. You can  also use
  1000.     run to chain a procedure to another one.
  1001.  
  1002.     The  for...to...step  and  next  keywords  are  used  to  perform  loop
  1003.     operation.
  1004.  
  1005.     Finally graph,pixel,  dot and  line are  used for  procedure controlled
  1006.     graphics.
  1007.  
  1008.     The end keyword is used to finish a procedure execution.
  1009.  
  1010.     For more info:      help "procedure_basic"
  1011.  
  1012.  
  1013.     9.3. Writing a simple procedure.
  1014.     --------------------------------
  1015.  
  1016.     Let suppose you  have very often to convert distance  from km to miles.
  1017.     It  could be useful to write a simple procedure that ask you to enter a
  1018.     distance in km and that convert it into mile. The  conversion result is
  1019.     displayed and the execution finish.
  1020.  
  1021.     Such a procedure is trivial and could be:
  1022.  
  1023.          input "Enter km to convert : ",k
  1024.          print "Equivalent in mile  : "; k / 1.609344
  1025.          end
  1026.  
  1027.     To  edit and save such procedure, from  the Mcalc prompt, give the edit
  1028.     command. Strike now a e to  (E)dit the procedure. Enter the three lines
  1029.     and finish each with a enter.  Strike the <ESC> key to return to  menu.
  1030.     Select now option (S)ave and save this procedure under the name 'mile'.
  1031.     The screen looks now as this one :
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.                                        17
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.                          Mcalc : The Master Calculator.
  1047.  
  1048.  
  1049.     input "Enter km to convert : ",k                                  
  1050.     print "Equivalent in miles : ";k / 1.609344                       
  1051.     end                                                               
  1052.                                                                       
  1053.                                                                       
  1054.     Command mode : (L)oad, (S)ave, (E)dit, (R)un, (N)ew, (D)ir, (Q)uit
  1055.  
  1056.     The procedure is ready to run. Run it by striking the (R)un option. You
  1057.     obtain  the  following  screen if  you  answer for  example  10  at the
  1058.     question.
  1059.  
  1060.  
  1061.     Enter km to convert : 10                 
  1062.     Equivalent in miles :  6.213711922373339
  1063.                                     
  1064.     Mcalc >                                 
  1065.  
  1066.     To execute a second case, strike  the F2 key or type edit  and strike r
  1067.     again. Answer another value.
  1068.     If you have  to convert many values, it is  preferable that the program
  1069.     is modified like this one:
  1070.  
  1071.     10   input "Enter km to convert (negative value to quit) : ",k
  1072.          if k < 0 then end
  1073.          print "Equivalent in mile  : "; k / 1.609344
  1074.          goto 10
  1075.  
  1076.     To modify the program, select again F2 or edit, then the (E)dit option.
  1077.     Now   you  have  to  retype  completely  the  first  line.  (The  small
  1078.     incorporate editor  does not  support character insertion.)  Finish the
  1079.     line with a enter. This will automatically insert an empty line for the
  1080.     second line  of our procedure. Now type the  line 'if k<0 then end' but
  1081.     don't strike any Enter at the end of this line. Move now the  cursor to
  1082.     the beginning  of the  fourth line and  overwrite the 'end'  with 'goto
  1083.     10'.
  1084.     Strike an <ESC>  to quit the  edition mode.  Select (R)un. Because  you
  1085.     have  modified the  procedure, Mcalc ask  you if  you want  to save it.
  1086.     Answer 'Y' for Yes and return.  The previous file is overwritten by the
  1087.     new one, and the execution is started....
  1088.  
  1089.     Enter km to convert (negative value to quit) : 1  
  1090.     Equivalent in miles :  0.621371192237334          
  1091.     Enter km to convert (negative value to quit) : 10 
  1092.     Equivalent in miles :  6.2137119223733900         
  1093.     Enter km to convert (negative value to quit) : 100
  1094.     Equivalent in miles :  62.1371192237339000        
  1095.     Enter km to convert (negative value to quit) : 2  
  1096.     Equivalent in miles :  1.242742384474668          
  1097.     Enter km to convert (negative value to quit) : -1 
  1098.  
  1099.                                        18
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.                          Mcalc : The Master Calculator.
  1108.  
  1109.  
  1110.     Mcalc >                                           
  1111.  
  1112.     For more info:      help "edit"
  1113.     For more info:      help "internal_editor"
  1114.  
  1115.  
  1116.     9.4. Running a procedure.
  1117.     -------------------------
  1118.  
  1119.     To execute a procedure, you have the following possibilities:
  1120.  
  1121.     1.   Go in editor mode with edit.
  1122.          Load the procedure to the editor memory with (L)oad.
  1123.          or Write the procedure with (E)dit.
  1124.          Select the (R)un option.
  1125.  
  1126.     2.   If the procedure is already in the editor memory....
  1127.          Strike F2 followed by R.
  1128.  
  1129.     3.   You can also directly load a procedure from a file and run it with
  1130.          the run command.
  1131.  
  1132.          For example: quit Mcalc, restart it and give directly the command:
  1133.  
  1134.                                    run 'mile'
  1135.  
  1136.     Mcalc > run "mile"                                                     
  1137.     Enter km to convert (negative value to quit) : 12                      
  1138.     Equivalent in miles :  7.4564543068980070                              
  1139.     Enter km to convert (negative value to quit) : -1                      
  1140.  
  1141.     Mcalc >
  1142.  
  1143.     4.   If  a  procedure begins  with  a  label  (the  address of  a  goto
  1144.          statement  for example) and is already loaded into memory, you can
  1145.          run it with the run command followed by that label.
  1146.  
  1147.          For  example, our 'mile' procedure begins with the label '10'. You
  1148.          can run it again by giving:
  1149.  
  1150.     Mcalc > run 10                                          
  1151.     Enter km to convert (negative value to quit) : 2        
  1152.     Equivalent in miles :  1.242742384474668                
  1153.     Enter km to convert (negative value to quit) : -1       
  1154.                                                             
  1155.     Mcalc >                                                 
  1156.                                                  
  1157.     For more info:      help "run"           
  1158.  
  1159.  
  1160.                                        19
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.                          Mcalc : The Master Calculator.
  1169.  
  1170.  
  1171.     9.5. Multiple entries procedure and function keys.
  1172.     --------------------------------------------------
  1173.  
  1174.     With  Mcalc, you  can write  multiple entries  procedure and  call each
  1175.     subprocedure using  its label or a function key. For example, write the
  1176.     following procedure and save it under the name 'convert'. 
  1177.  
  1178.     1    input "km-->mile : ",k
  1179.          print k;" km = "; k/1.609344 ; "mile"
  1180.          end
  1181.     2    input "mile-->km : ",k
  1182.          print k;" mile = "; k*1.609344 ; "km"
  1183.          end
  1184.  
  1185.     Now, be  sure that this procedure is loaded into the editor memory. (To
  1186.     be sure, give the edit command: the procedure must be displayed). If it
  1187.     is  not the case load  it. Quit the editor mode  and come back into the
  1188.     evaluation mode.
  1189.     To  convert a km distance  into miles, type run  1. To make the inverse
  1190.     conversion, type run 2.
  1191.  
  1192.  
  1193.     Mcalc > run 1                                  
  1194.     km-->mile : 2                                  
  1195.     2.000000000000000  km =  1.242742384474668 mile
  1196.                                                    
  1197.     Mcalc > run 2                                  
  1198.     mile-->km : 1.242742384474668                                   
  1199.     1.242742384474668  mile =  2.000000000000000 km
  1200.                                                    
  1201.     Mcalc >                                        
  1202.  
  1203.  
  1204.     A  very useful  feature of  Mcalc is  the user function  keys to  run a
  1205.     procedure.
  1206.     If you strike a SHIFT Function key, automatically it runs the procedure
  1207.     from the label 0  to 9. (Label 0 is  affected to Shift F10,  label 1 to
  1208.     Shift F1 ....).
  1209.  
  1210.     For example, to convert now a km into mile, strike Shift F1. To convert
  1211.     mile to km, strike Shift F2.
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.                                        20
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.                          Mcalc : The Master Calculator.
  1230.  
  1231.  
  1232.     9.6. Debugging a procedure.
  1233.     ---------------------------
  1234.  
  1235.     If you suspect some fault into a procedure, it is possible to debug it.
  1236.  
  1237.     To  debug a procedure,  Mcalc supplies two features  selectable via the
  1238.     setup command: 
  1239.  
  1240.     Procedure break enabled. =                
  1241.          When you run  a procedure very  long (or mayby  error an  infinite
  1242.          loop), if  you strike any  key and this  flag is set,  the running
  1243.          procedure  is aborted.  If this  flag is  reset, the  keystroke is
  1244.          ignored.
  1245.          Default mode is 'Yes'.
  1246.  
  1247.     Procedure trace mode enabled. =           
  1248.          When this flag is set  and a procedure is running, it  will run in
  1249.          single step mode.
  1250.          Default mode is 'No'.
  1251.  
  1252.     Give  now the setup  command and modify  this last flag  to 'Y'. Finish
  1253.     with  a '/'  to avoid  listing all  other  settings. Now,  Mcalc reacts
  1254.     strangely with the following:
  1255.  
  1256.     Mcalc > setup                                      
  1257.                                                        
  1258.     General purpose flags:                             
  1259.     Trigonometric mode : (R)adian, (D)egree =       <D>
  1260.     Programmer binary output. =                     <N>
  1261.     Help automatically supplied. =                  <N>
  1262.     Procedure break enabled. =                      <Y>
  1263.     Procedure trace mode enabled. =                 <Y>
  1264.     Display status in prompt =                      </>
  1265.     k := 0.000000000000000 ---> 2.000000000000000      
  1266.     Next instruction :                                 
  1267.     end                                                
  1268.     Strike any key to continue ..., <ESC> to abort!    
  1269.  
  1270.     Strike a <ESC> and you obtain the Mcalc prompt again. 
  1271.     When  the   procedure  trace  mode  is  enabled,  Mcalc  displays  each
  1272.     instruction before executing it.
  1273.     Also,  each time the  content of any  variable 'a' to  'z' is modified,
  1274.     Mcalc displays  the previous and the  new values. You have  to strike a
  1275.     key to proceed with  the instruction. If  you strike <ESC>, you  cancel
  1276.     the  procedure  execution and  come  back to  the prompt.  For example,
  1277.     strike the Shift F1 key to convert 12 km into miles....
  1278.  
  1279.  
  1280.  
  1281.  
  1282.                                        21
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.                          Mcalc : The Master Calculator.
  1291.  
  1292.  
  1293.     Mcalc > run 1                                    
  1294.     km-->mile : 12                                   
  1295.                                                      
  1296.     k := 2.000000000000000 ---> 12.000000000000000   
  1297.     Next instruction :                               
  1298.                                                      
  1299.     Strike any key to continue ..., <ESC> to abort!  
  1300.  
  1301.     Strike now any  key, excepted  <ESC>. Mcalc continues  and execute  the
  1302.     print command...
  1303.  
  1304.     12.000000000000000  km =  19.312128000000000 mile
  1305.                                                      
  1306.     Next instruction :                               
  1307.            end                                       
  1308.     Strike any key to continue ..., <ESC> to abort!  
  1309.     Mcalc > 
  1310.  
  1311.     Give  again the setup command and switch  back the 'trace' flag to 'N'.
  1312.     Keep the 'Procedure break enabled' active.
  1313.  
  1314.     Now, write  this stupid infinite loop  procedure and save it  as a file
  1315.     under the name 'bug'.
  1316.  
  1317.          i=1
  1318.     10   print i
  1319.          i=i+1
  1320.          goto 10
  1321.          end
  1322.  
  1323.     Now, run  it. You will see  the loop is continuously  restarted and you
  1324.     loose the control of Mcalc.
  1325.     If such occurs, it is  always possible to break a running  procedure by
  1326.     striking any key  when the procedure is running.  This is only possible
  1327.     if the 'Procedure break enabled' flag from setup is 'Y'. Else, your key
  1328.     strokes are ignored and you  have to restart your computer to  keep the
  1329.     control back.
  1330.     If the  'Procedure break enabled' is  set to 'N', the  speed of running
  1331.     procedure  is slightly  increased. Use  only this  setting to  run safe
  1332.     procedure,  already  debugged, and  when  you experience  that  it runs
  1333.     slowly !!!
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.                                        22
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.                          Mcalc : The Master Calculator.
  1352.  
  1353.  
  1354.     9.7. Using an external editor.
  1355.     ------------------------------
  1356.  
  1357.     The internal  editor provided  by  Mcalc is  small and  fast, but  very
  1358.     limited in its features. This is not a major limitation of Mcalc  as it
  1359.     is  possible to  configure  it to  use  your favourite  editor. To  use
  1360.     another editor, called  an external  editor because it  is not part  of
  1361.     Mcalc, you need to define one MSDOS environment variable.
  1362.     The  procedure is  fully  described into  the  registered version  user
  1363.     manual of Mcalc.
  1364.  
  1365.     Remark:   The  registered version of Mcalc is supplied now with its own
  1366.               editor:  Notepad.Exe.  It is  strongly  advised  to use  this
  1367.               editor, as  it includes  special features suitable  for using
  1368.               when editing a keyboard macro.
  1369.  
  1370.  
  1371.     10. Using the plotter and the root solver.
  1372.     ------------------------------------------
  1373.  
  1374.     With Mcalc, you can plot easily any equation, or user defined function.
  1375.     You  can  also find  the  root  of such  equation.  You  will find  the
  1376.     description and an example in the online help.
  1377.  
  1378.     For more info:      help "plot"
  1379.     For more info:      help "solve"
  1380.     For more info:      help "solve_"
  1381.  
  1382.     If you  want to plot an expression that is not directly writable in the
  1383.     form of a function y=f(x), such as a parametric equation, you can write
  1384.     a procedure using the 'graph' command and related commands.
  1385.  
  1386.     For more info:      help "graph"
  1387.  
  1388.     For  example, the following  procedure can  be used to  draw a lissajou
  1389.     figure:
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.                                        23
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.                          Mcalc : The Master Calculator.
  1413.  
  1414.  
  1415.             1 print "Lissajou figure...." 
  1416.               print " "                     
  1417.               input "Enter frequency 1 : ",a
  1418.               input "Enter frequency 2 : ",b
  1419.               input "Number of points  : ",n
  1420.               d = 2 * pi / n             
  1421.               graph -1.2,-1.2,3.2,1.2       
  1422.               t=0                           
  1423.               for i=0 to n step 1                 
  1424.                   x=2.0 * cos(a*t) + 1.0    
  1425.                   y=sin(b*t)                
  1426.                   if i=0 then pixel x,y,-1  
  1427.                   line x,y                  
  1428.                   t=t+d                     
  1429.               next                          
  1430.               end                           
  1431.  
  1432.     11. Using the statistical functions and commands.
  1433.     -------------------------------------------------
  1434.  
  1435.     Mcalc supplies the following commands and functions. 
  1436.  
  1437.     The  read_ command  is used  to read  a data  structured file  into the
  1438.     memory variables. When the data are loaded, further statistical process
  1439.     are  possibles. The mean  and sigma functions are  available to compute
  1440.     the average  and the standard spread  over a serie of  numbers. The cor
  1441.     command  can  be used  to  compute a  correlation function  between two
  1442.     series of values. The  reg command lets you compute  very sophisticated
  1443.     statistics. These regression results can be viewed as data tables using
  1444.     listr or as graphics via plotr.
  1445.     Also,   Mcalc  supplies   two  functions   to  study   gaussian  normal
  1446.     distribution: normal and inormal.
  1447.  
  1448.     For more info:      help "statistics"
  1449.  
  1450.  
  1451.     11.1. Reading a structured data file.
  1452.     -------------------------------------
  1453.  
  1454.     A structured data file is a text file that contains columns of values.
  1455.     The demonstration  file "demo05.txt"  is a  good example  of structured
  1456.     data file.
  1457.     As you can see if  you type or print it, this file  contains a serie of
  1458.     columns of values. The first line is a text that play a role of comment
  1459.     for us. To load for example the data relative at a linear function, let
  1460.     us give the following command:
  1461.  
  1462.  
  1463.  
  1464.  
  1465.                                        24
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.                          Mcalc : The Master Calculator.
  1474.  
  1475.  
  1476.     R_Mcalc > read_ "demo05",2,10,1,2    
  1477.                                         
  1478.     File loaded! Area pointer is at #26.
  1479.     R_Mcalc >                           
  1480.  
  1481.     For more info:      help "read_"
  1482.  
  1483.     Mcalc responds is the value of an 'Area Pointer'.
  1484.  
  1485.  
  1486.     11.2. The concept of area pointer.
  1487.     ----------------------------------
  1488.  
  1489.     Most statistical  process, such  as regression analysis  or statistical
  1490.     calculations are done on large series of numbers. It is thus  necessary
  1491.     to use a convenient notation to specify a serie of  numbers quickly and
  1492.     easily. This is the purpose of the Area Pointer concept used by Mcalc.
  1493.  
  1494.     An area pointer is a block of successive contiguous memories (direct or
  1495.     indirect  access) whose  contents  give the  adress  of other  indirect
  1496.     access memories.
  1497.  
  1498.     For more info:      help "area_pointer"
  1499.  
  1500.     The following figure illustrate the concept of Area Pointer:
  1501.      
  1502.          Area_Pointer
  1503.           │
  1504.           │
  1505.           │
  1506.           │         Contiguous block:
  1507.           └─────>── Area_X────────────────>──Contiguous block
  1508.                     Area_Y────────────────>──Contiguous block  
  1509.                     Area_Z────────────────>──Contiguous block
  1510.                     Area_R────────────────>──Contiguous block
  1511.                     Area_Size               
  1512.  
  1513.     As you can see on  this figure, an Area Pointer is just a succession of
  1514.     5  variables. The  first four contain  a value that  is a  pointer to a
  1515.     variable block. Each pointer is the indirect access adress of the first
  1516.     variable of each block.
  1517.     The fith value is the size of the first three blocks.
  1518.     An  area pointer  is refered  by  its starting  adress. This  means the
  1519.     indirect adress of  the first pointer to the first  X block. Each block
  1520.     is contiguous; this  means that inside a block  all variables are used.
  1521.     The concept of Area Pointer  is powerfull enougth to works  with blocks
  1522.     that are not necessary contiguous with each other. This is not the case
  1523.     in our previous example, but could be so.
  1524.  
  1525.  
  1526.                                        25
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.                          Mcalc : The Master Calculator.
  1535.  
  1536.  
  1537.     Summary:  Each time you  load a data serie from  a data structured file
  1538.               using the read_ command,  Mcalc returns you the adress  of an
  1539.               Area Pointer. This unique adress will be used to specify your
  1540.               data during each regression calculus.
  1541.  
  1542.  
  1543.     11.3. Computing single statistics.
  1544.     ----------------------------------
  1545.  
  1546.     When your  data are loaded into memory, you can  use the mean and sigma
  1547.     functions to perform statistical calculations. In our previous example,
  1548.     we have  loaded two series of  numbers representing the x  and y values
  1549.     for 10 points. Let us now compute the mean and average of x series....
  1550.  
  1551.     For more info:      help "mean"
  1552.     See also related topics: sigma, min and max.
  1553.  
  1554.     R_Mcalc > mean(40,10)     
  1555.     Answer =             16.75
  1556.                               
  1557.     R_Mcalc > sigma(40,10)    
  1558.     Answer =  4.54147553114624
  1559.  
  1560.     11.4. Performing linear and non-linear regression analysis.
  1561.     -----------------------------------------------------------
  1562.  
  1563.     A linear regression  analysis can  be computed directly  using the  reg
  1564.     command. The command uses the following syntax:
  1565.                           reg area pointer , 0 , order
  1566.  
  1567.     In fact, Mcalc performs  a polynomial regresssion. Order is  the degree
  1568.     of   the  polynome.  By  specifing  a  order=1,  you  obtain  a  linear
  1569.     regression. Compute the linear regression from  the already loaded data
  1570.     of the previous example:
  1571.  
  1572.     R_Mcalc > reg 26,0,1                    
  1573.     Regression in progress! Please wait ....
  1574.     Regression results:                     
  1575.     Coef[00]=                3              
  1576.     Coef[01]=                2              
  1577.     Regression sigma =                 0    
  1578.     Correlation      =                 1    
  1579.                                             
  1580.     R_Mcalc >                               
  1581.  
  1582.     For more info:      help "reg"
  1583.     For more info:      help "plotr"
  1584.     For more info:      help "listr"
  1585.  
  1586.  
  1587.                                        26
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.                          Mcalc : The Master Calculator.
  1596.  
  1597.  
  1598.     11.5. Manual regression using the solver.
  1599.     -----------------------------------------
  1600.  
  1601.     Despite the fact that the Mcalc user defined model offers already a lot
  1602.     of possibilities,  there are  situations where  the equation  cannot be
  1603.     defined with  any of the previous model. In such situation, it is still
  1604.     possible  to perform a regression using a least square criterium model,
  1605.     via  a  combination  of  a  Procedure,  the  solver  and  an  iteration
  1606.     algorithm.
  1607.  
  1608.     You will  find a full  chapter dedicated to  this subject, with  worked
  1609.     examples, in the manual supplied with the registered version of Mcalc.
  1610.  
  1611.  
  1612.     12. Numerical analysis.
  1613.     -----------------------
  1614.  
  1615.     Mcalc supplies also special commands used for numerical analysis.
  1616.  
  1617.     For more info:      help "integral"
  1618.     For more info:      help "interpol"
  1619.  
  1620.     This shareware package is supplied with the procedure "demo04.mcp" that
  1621.     can be used to draw an interpolated curve going through a serie of data
  1622.     points loaded via 'read_' or computed and stored in memory by any other
  1623.     method.  Refer also to the demonstration to see directly that procedure
  1624.     at work.
  1625.  
  1626.  
  1627.  
  1628.     13. Physical units conversion.
  1629.     ------------------------------
  1630.  
  1631.     Mcalc is  supplied with a database  of up to around 100  units. Via the
  1632.     'convert', 'rconv' and 'iconv' commands, you can convert values between
  1633.     units.
  1634.  
  1635.     For more info:      help "convert"
  1636.  
  1637.     The registered version of Mcalc is supplied with an utility that can be
  1638.     used  to customize the  database following your needs.  A database have
  1639.     space for up to 200 units!
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                                        27
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.                          Mcalc : The Master Calculator.
  1657.  
  1658.  
  1659.     14. Using keyboard macros.
  1660.     --------------------------
  1661.  
  1662.     Mcalc  supports  keyboard  macros.  A  macro  is  just  a  sequence  of
  1663.     keystrokes  that can be played automatically after you have stored them
  1664.     into a file.  The compleet demonstration used in  this package has been
  1665.     implementated as an unique macro.
  1666.  
  1667.     For more info:      help "macro"
  1668.  
  1669.     The macro compiler  and the description of how to  write and run macros
  1670.     are described in details in the registered version of Mcalc.
  1671.  
  1672.  
  1673.     15. Advanced and particular topics.
  1674.     -----------------------------------
  1675.  
  1676.     15.1. Session log file support.
  1677.     -------------------------------
  1678.  
  1679.     If you  use a small desk  calculator, you are sometimes  happy having a
  1680.     paper  roll printout of al the operations  you perform. By that way, if
  1681.     you  discover a  mistake after  a long  series of  operations,  you can
  1682.     always look at the paper  to find your error or to remember how you did
  1683.     some specific calculations.
  1684.  
  1685.     A similar  facility is available with Mcalc and is called the log file.
  1686.     A log file is a text file where all the dialog from the main screen can
  1687.     be redirected. To  use the log file system, you  just use two commands:
  1688.     write and close.
  1689.  
  1690.     The  write command  is used  to specify  the loggin  file you  want the
  1691.     listing  of your current session to  go. You may get  the loggin on any
  1692.     ASCII text file, or on the line printer.
  1693.  
  1694.     For example, to  make a log  file 'mylog.txt'  of the current  session,
  1695.     give the following command:
  1696.  
  1697.     D_Mcalc > write "mylog.txt"
  1698.                                
  1699.     D_Mcalc >                  
  1700.  
  1701.     Now, all the dialog you type and Mcalc answers go to that file. This is
  1702.     true,  as well  in  evaluation mode,  as  all 'print'  instructions  in
  1703.     procedure mode. The log file is appended until:
  1704.  
  1705.          -    you use another 'write' command.
  1706.          -    you close the logger with the 'close' command.
  1707.          -    you quit Mcalc with the 'quit' command.
  1708.  
  1709.                                        28
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.                          Mcalc : The Master Calculator.
  1718.  
  1719.  
  1720.     If  the specified log file already exists,  it is appended; it is never
  1721.     overwritten.  Please, refer to the on-line help for the compleat syntax
  1722.     of the 'write' command.
  1723.  
  1724.     In the log  file, your input  commands (in evaluation mode)  are always
  1725.     preceded by a ';' character.
  1726.     Mcalc answers looks exactly  as they come on the  screen. The debugging
  1727.     information in  trace mode, or  the iterations  of the  solver are  not
  1728.     copied to the log file.
  1729.  
  1730.  
  1731.     15.2. The initialization 'mcalc.mcp' procedure.
  1732.     -----------------------------------------------
  1733.  
  1734.     When  you  start  Mcalc, it  search  in  the  working directory  for  a
  1735.     procedure named 'Mcalc'. If it find it, it will run it automatically( a
  1736.     little bit  as the 'autoexec.bat'  file of your  PC). By that  way, you
  1737.     have the possibility to  initialize some variables or to  open always a
  1738.     log file,  or thinks like that. You must  take care of two things, when
  1739.     you create this procedure:
  1740.  
  1741.          -    it must always finish with the 'end' instruction.
  1742.          -    it may not include  instructions like 'setup' that initiate a
  1743.               dialog (or you have to answer the dialog before the procedure
  1744.               will continue). This is true for any kind of procedure.
  1745.  
  1746.     Tips:          The  'mcalc' procedure can be very useful if you plan to
  1747.                    work always with the same ten user functions Shift_F1 to
  1748.                    Shift_F10. In such case, write a procedure with multiple
  1749.                    entries as  described in  chapter 4. Preceded  the first
  1750.                    label  by  a  line  with  'end'  or  the  initialization
  1751.                    procedure  finished by  'end'. So,  each time  you start
  1752.                    Mcalc,  the initialization  is done  and  your keystroke
  1753.                    procedures  are available.  Another  way to  work is  to
  1754.                    create one simple initialisation procedure that contains
  1755.                    and  finish with  a 'load'  instruction, such  that your
  1756.                    favourite procedure is directly available when you start
  1757.                    Mcalc.
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.                                        29
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.                          Mcalc : The Master Calculator.
  1779.  
  1780.  
  1781.     15.3. Using the command line mode.
  1782.     ----------------------------------
  1783.  
  1784.     The command line mode is a special case of the evaluation mode. 
  1785.  
  1786.     If you  have only one calculation to do,  it is possible to specify the
  1787.     expression directly into  the command line, at  the same time  you type
  1788.     'mcalc' to  start Mcalc. For  example, from  the DOS  prompt, type  the
  1789.     following to make this calculation:
  1790.  
  1791.     C:\TOOLS>mcalc sqrt(1-cos(30)^2)
  1792.     Answer =                0.5        
  1793.                                        
  1794.     C:\TOOLS>                       
  1795.  
  1796.     If the expression you type  at the command prompt could interfere  with
  1797.     MSDOS, enclose it within quotes....
  1798.  
  1799.     C:\C\SOURCE>mcalc 12/5      
  1800.     Answer =                2.4 
  1801.                                 
  1802.     C:\C\SOURCE>mcalc 12 / 5    
  1803.     Answer =                 12 
  1804.                                 
  1805.     C:\C\SOURCE>mcalc "12 / 5"  
  1806.     Answer =                2.4 
  1807.                                 
  1808.     C:\C\SOURCE>                
  1809.  
  1810.     In the  first  case, Mcalc  recognizes  a correct  expression,  because
  1811.     '12/5' was  in  one word.  In the  second case,  Mcalc  make a  mistake
  1812.     because MSDOS interprets ' 12 / 5 ' as three different words, and Mcalc
  1813.     expects  only one expression in the  command line. The third example is
  1814.     correct,  because  MSDOS  recognizes  this time  the  whole  expression
  1815.     between quotes as one unique word.
  1816.  
  1817.  
  1818.     15.4. Using graphical fonts files.
  1819.     ----------------------------------
  1820.  
  1821.     When  in graphical mode, Mcalc  can use character fonts  to improve the
  1822.     graphic quality. A graphic font is a file having a .FON extension, like
  1823.     the  one delivered with Windows 3.1. This package is delivered with the
  1824.     file HELVB.FON that contains Helvetica fonts you can use if you have an
  1825.     EGA  or VGA adapter. To  use this font file with  a EGA or VGA adapter,
  1826.     and assuming you have copied all Mcalc files into the subdirectory
  1827.     c:\mcalc, you must give the two commands before starting Mcalc:
  1828.  
  1829.  
  1830.  
  1831.                                        30
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.                          Mcalc : The Master Calculator.
  1840.  
  1841.  
  1842.          set fontdir=c:\mcalc
  1843.          set fontface=t'helv'w10h8b
  1844.  
  1845.     You could for  example add  these two commands  into your  autoexec.bat
  1846.     file.
  1847.     Before using  fonts, you must also  enable their usage  via the 'setup'
  1848.     command.
  1849.  
  1850.     For more info:      help "setup"
  1851.  
  1852.  
  1853.     15.5. Customizing user function keys.
  1854.     -------------------------------------
  1855.  
  1856.     The  Mcalc package  is  supplied with  the  mcalc.key file.  This  file
  1857.     contains the definition assigned to the function keys F1 to F10, Shift,
  1858.     Ctrl & Alt, inside Mcalc. To view the current assignment of these keys,
  1859.     give the listk command.
  1860.  
  1861.     The  registered version  of Mcalc  is distributed  with the  two files:
  1862.     mckey.lst and mckey.exe.
  1863.     With  these two files, you have the  possibility to modify the user key
  1864.     definitions as you want.
  1865.  
  1866.     For more info:      help "mckey"
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.                                        31
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.                          Mcalc : The Master Calculator.
  1901.  
  1902.  
  1903.  
  1904.     16. The Mcalc files.
  1905.     --------------------
  1906.  
  1907.     Version 1.99 of Mcalc uses and recognizes the following files:
  1908.  
  1909.  
  1910.     mcalc.exe                is the Mcalc program itself.
  1911.     mcalc.hlp & mcalc.hl2    are the online help files.  The first contains
  1912.                              all   the  help  material,  while  the  second
  1913.                              supplies the fast access index system.
  1914.     mcalc.ini                is the file that  store your current setup. It
  1915.                              is created the first time you run Mcalc.
  1916.     mcalc.lic                is the license information file for registered
  1917.                              users.
  1918.     helvb.fon                is the Helveticca  fonts characters to  use in
  1919.                              graphic mode.
  1920.     .mcp                     all  Master  Calculator  Procedures  are  text
  1921.                              files having that extension.
  1922.     .mem                     all  variables   dump  files   produced   with
  1923.                              'savevar'.
  1924.     mc_unit.dat              the database of physical units.
  1925.     mcalc.key                the user keys definition file (compiled).
  1926.     mckey.lst                the user keys definition file (source).
  1927.     mckey.exe                utility to make mcalc.key.
  1928.     makeunit.exe             utility to edit mc_unit.dat.
  1929.     notepad.*                the supplied editor.
  1930.     assist.exe               the assistant add-in.
  1931.     mac.exe & mcmac.exe      the macro compiler and its driver.
  1932.  
  1933.  
  1934.     Remark:   Not all these files are supplied with the shareware version!
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.                                        32
  1954.  
  1955.